<%@page contentType="text/html; charset=utf-8"%>
<%@ include file="../inc/TagLibs.jsp"%>
<c:set var="pageTitle" value="出库单打印" />
<%@ include file="../inc/PrintTitle.jsp"%>
<head>
<script src="/js/popup_ext.js"></script>
<script language="javascript">
	function doCancel(){
		window.close();
	}
	function doPrint(){
		ShowConfirm('确认框','确定开始打印吗？',340,80,"doPrintCallBack()");
	}
	function doPrintCallBack(){
		if(popRetVal!=null){
			document.getElementById("noPrinSpan").style.display="none";
			printContent("管理易-出库单","${enterpriseInfo.doPrint}","${enterpriseInfo.printWidth}");
			document.getElementById("noPrinSpan").style.display="";
		}
	}
	function showTotalDiv(cost,divId){
		var str="";
		str=str+"合计(大写)：";
		str=str+getBigMoney(""+cost);
		str=str+"<b>￥</b>"+cost+"&nbsp;";
		document.getElementById(divId).innerHTML=str;
	}
</script>
</head>
<body style="background-color:#FFFFFF">
<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
	<tr>
		<td>
			<table width="98%" border="0" cellspacing="1" cellpadding="1" align="center">
				<tr>
					<td height="40px" align="center" class="FontLarge_Bold">${licenseInfo.enterpriseName} 出库单</td>
				</tr>
				<tr>
				  	<td class="FontSmall" align="right">NO.&nbsp;${record.outBill.billCode}</td>
			  </tr>
		  </table>
		</td>
	</tr>
	<tr>
		<td>
			<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="#000000" class="ListTable">
				<tr class="ListTrPrint">
			      	<td class="FontSmall" width="40%">需方单位：${record.requirerName}</td>
			      	<td class="FontSmall" width="20%">仓库：${record.stoName}</td>
			      	<td class="FontSmall" width="20%">出库类型：${record.outTypeName}</td>			      	
			      	<td width="20%" class="FontSmall"  align="right">日期：<fmt:formatDate value="${record.outBill.outDate}" pattern="yyyy-MM-dd"/></td>
				</tr>
				<tr class="ListTrPrint">
			      	<td class="FontSmall">业务单号：${record.outBill.businessBillCode}</td>
			      	<td class="FontSmall" colspan="3">备注：${record.outBill.mark}</td>
				</tr>
		  </table>
		</td>
	</tr>
	<tr>
		<td height="3"></td>
	</tr>
	<tr>
		<td>
			<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0" class="small_border">
				<tr class="ListTrPrint">
					<td width="5%" class="FontSmall_Bold"><div align="center">行号</div></td>
					<td width="15%" class="FontSmall_Bold"><div align="center">材料编号</div></td>
					<td width="25%" class="FontSmall_Bold"><div align="center">品名规格</div></td>
					<td width="10%" class="FontSmall_Bold"><div align="center">单位</div></td>
					<td width="10%" class="FontSmall_Bold"><div align="center">数量</div></td>
					<c:if test="${currentUser.user.userType!=1 && fn:indexOf(currentUser.privs,';STOR_COST;')==-1 || printCost=='0'}">
						<td width="35%" class="FontSmall_Bold"><div align="center">备注</div></td>
					</c:if>
					<c:if test="${(currentUser.user.userType==1 || fn:indexOf(currentUser.privs,';STOR_COST;')!=-1) && printCost!='0'}">
						<td width="10%" class="FontSmall_Bold"><div align="center">单价</div></td>
						<td width="10%" class="FontSmall_Bold"><div align="center">金额</div></td>
						<td width="15%" class="FontSmall_Bold"><div align="center">备注</div></td>
					</c:if>
				</tr>
				<c:forEach var="item" items="${record.items}" varStatus="i">
				<tr class="ListTrPrint">
					<td class="FontSmall"><div align="center">${i.index+1}</div></td>
					<td class="FontSmall"><div align="center">${item.productCode}</div></td>
					<td class="FontSmall"><div align="center">${item.productName}</div></td>
					<td class="FontSmall"><div align="center">${item.unit}</div></td>
					<td class="FontSmall"><div align="center"><commonTag:parseBigDecimal source="${item.outBillItem.amount}" /></div></td>
					<c:if test="${(currentUser.user.userType==1 || fn:indexOf(currentUser.privs,';STOR_COST;')!=-1) && printCost!='0'}">
						<td class="FontSmall"><div align="center"><commonTag:parseBigDecimal source="${item.unitPrice}" /></div></td>
						<td class="FontSmall"><div align="center"><commonTag:parseBigDecimal source="${item.outBillItem.cost}" /></div></td>
					</c:if>
					<td class="FontSmall"><div align="center">${item.outBillItem.mark}</div></td>
				</tr>
				</c:forEach>
				<c:if test="${(currentUser.user.userType==1 || fn:indexOf(currentUser.privs,';STOR_COST;')!=-1) && printCost!='0'}">
			  	<tr  class="ListTrPrint">
					<td class="FontSmall" colspan="8" >
						<div align="right" id="totalDiv">&nbsp;</div>
					</td>			  	
			  	</tr>	
				</c:if>					
		  </table>
		</td>
	</tr>
	<tr>
		<td height="3"></td>
	</tr>
	<tr>
		<td>
			<table width="98%" border="0" cellspacing="0" cellpadding="0" align="center" class="ListTable">
				<tr class="ListTrPrint">
					<td class="FontSmall" width="33%">开单人：${record.outBill.createrName}</td>
					<td class="FontSmall" width="33%">经办人：${record.outBill.managerName}</td>
					<td class="FontSmall" width="34%">审核人：${record.outBill.examinerName}</td>
				</tr>
			</table>
		</td>
	</tr>
	<c:if test="${codeRule.printFoot!=null && codeRule.printFoot!=''}">
	<tr>
		<td>
			<table width="98%" border="0" cellspacing="1" cellpadding="1" align="center">
				<tr>
					<td class="FontSmall"><commonTag:parseEnterToBr source="${codeRule.printFoot}" /></td>
				</tr>
			</table>
		</td>
	</tr>
	</c:if>
	<tr id="noPrinSpan">
		<td>
			<table width="98%" border="0" cellspacing="1" cellpadding="1" align="center">
				<tr>
					<td>
						<input type="button" id="printButton" class="Button" value=" 开始打印" onClick="doPrint();">
						<input type="button" id="cancelButton" class="Button" value=" 退 出 " onClick="doCancel();">
					</td>
				</tr>
			</table>
		</td>
	</tr>
</table>
</body>
</html>
<script language="javascript">
	showTotalDiv(${record.cost},'totalDiv');
</script>